/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session.stateful;


import entity.RightEntity;
import entity.SystemUserEntity;
import exception.EntityNotFoundException;
import java.util.Collection;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateful;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import session.stateless.SystemUserSessionBean;

/**
 *
 * @author thanhle
 */
@Stateful
@LocalBean
public class RightBean {

    @PersistenceContext
    EntityManager em;

   
    
    

 public RightEntity findRight(String name2){
//          Query query = (Query) em.createQuery(
//                "SELECT r FROM rights r WHERE r.rightname = :name2");
//        query.setParameter("name2", name2);
       RightEntity result = em.find(RightEntity.class, name2);
        System.out.println("ggggggg");
       // RightEntity result =  (RightEntity) query.getSingleResult();

        return result;
}
}